<?php
	class the_page {
		function on($p) {
			if (!isset($_GET["p"])&&($p=="home")) {
				return true;
			}
			if ($_GET['p'] == $p) {
				return true;
			}
			return false;
		}
		function width($i) {
			global $oh_object_page;
			$this->page['width'] = $i;
			return $oh_object_page;
		}
		function get_width() {
			if (isset($this->page["width"])) {
				return (String) $this->page["width"];
			} else {
				return "800";	
			}
		}
		function html_title($i) {
			global $oh_object_page;
			$this->page['html.title'] = $i;
			return $oh_object_page;
		}
		function menu($i) {
			if (!is_array($i)) $i = oh_string_to_array($i);			
			global $oh_object_page;
			$this->page['header.menu'] = $i;
			return $oh_object_page;			
		}
		function header_menu($i) {return $this->menu($i);}
		function get_header_menu() {
			if (isset($this->page["header.menu"])) {
				return $this->page["header.menu"];
			} else {
				return array(
					"Dashboard" => "",
				);	
			}
		}
		function header_title($i) {
			global $oh_object_page;
			$this->page['header.title'] = $i;
			return $oh_object_page;
		}
		function header_right($i) {
			global $oh_object_page;
			$this->page['header.right'] = $i;
			return $oh_object_page;
		}
		function content_title($i) {
			global $oh_object_page;
			$this->page['content.title'] = $i;
			return $oh_object_page;
		}
		function content_body($i) {
			global $oh_object_page;
			if (oh_is_valid_function($i)) {
				$this->func['content.body'] = $i;
			} else {
				$this->page['content.body'] = $i;
			}
			return $oh_object_page;
		}		
		function content($i) {return $this->content_body($i);}
		function sidebar($i) {
			global $oh_object_page;
			$this->page['sidebar'] = $i;
			return $oh_object_page;			
		}
		function get_page($link = false) {			
			if (!$link) {
				$link = oh("url");
			}
			$u = parse_url($link);
			if (isset($u['query'])) {
				parse_str($u['query'],$u);			
				$o = isset($u['page']) ? $u['page'] : "home";
				return $o;
			} else {
				return "home";
			}
		}		
		function is_active_page($link) {			
			global $oh_object_page;			
			$a = explode(".",$oh_object_page->get_page($link));
			$b = explode(".",$oh_object_page->get_page());
			return ($a[0] == $b[0]);	
		}
	}
?>
